#!/bin/bash

# 删除Go装目录
sudo rm -rf /usr/local/go

# 删除Java相关环境变量
sudo sed -i '/go environment variables/d' /etc/profile
sudo sed -i '/GOROOT/d' /etc/profile
sudo sed -i '/GOPATH/d' /etc/profile
sudo sed -i '/PATH.*\/go\/bin/d' /etc/profile



# 重新加载配置文件
source /etc/profile

# 检查Go卸载是否成功
if [ -z "$(command -v go)" ]; then
    echo "Go has been uninstalled successfully."
else
    echo "Failed to uninstall GO."
fi
